<template>
    <div class="header">
        <slot></slot>
        <i class="iconfont icon-icon--fanhui" v-if="back" @click="goBack"></i>
    </div>
</template>

<script>
    export default {
        props:{
          back:{  //传值
            type:Boolean,
            default:false
          }
        },
        methods: {
          goBack(){
            this.$router.go(-1);
          }
        }
    }
</script>

<style scoped lang="less">
  .header{
    position: fixed;
    top:0;
    left: 0;
    width: 100%;

    background: #82ffe0;
    height: 40px;
    text-align: center;
    line-height: 40px;
    font-weight: bold;

    i{
      position: fixed;
      left: 10px;
      font-size: 20px;
    }
  }
</style>
